/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author edilson
 */
@Entity
@Table(name = "DisciplinaProfessor")
public class DisciplinaProfessor implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    
    @ManyToOne
    @JoinColumn(name="disciplina", referencedColumnName="id")
    @Basic(optional=false)
    private Disciplina disciplina;
    
    @ManyToOne
    @JoinColumn(name="professor", referencedColumnName="id")
    @Basic(optional=false)
    private Professor professor;
    
    @Column(name="descricao", length=255)
    private String descricao; 
 
    
    @OneToMany(mappedBy = "disciplinaProfessor", cascade= CascadeType.ALL)
    private List<Ementa> ementas;
    
    @OneToMany(mappedBy = "disciplinaProfessor", cascade= CascadeType.ALL)
    private List<Turma> turmas;
    @OneToMany(mappedBy = "disciplinaProfessor", cascade= CascadeType.ALL)
    private List<ListaDisciplina> listaDisciplinas;
    
    
    public DisciplinaProfessor() {
    }

    public DisciplinaProfessor(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Disciplina getDisciplina() {
        return disciplina;
    }

    public void setDisciplina(Disciplina disciplina) {
        this.disciplina = disciplina;
    }

    public Professor getProfessor() {
        return professor;
    }

    public void setProfessor(Professor professor) {
        this.professor = professor;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public List<Ementa> getEmentas() {
        return ementas;
    }

    public void setEmentas(List<Ementa> ementas) {
        this.ementas = ementas;
    }

    public List<Turma> getTurmas() {
        return turmas;
    }

    public void setTurmas(List<Turma> turmas) {
        this.turmas = turmas;
    }

    public List<ListaDisciplina> getListaDisciplinas() {
        return listaDisciplinas;
    }

    public void setListaDisciplinas(List<ListaDisciplina> listaDisciplinas) {
        this.listaDisciplinas = listaDisciplinas;
    }


   
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DisciplinaProfessor)) {
            return false;
        }
        DisciplinaProfessor other = (DisciplinaProfessor) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.DisciplinaProfessor[id=" + id + "]";
    }

}
